package org.luxor.generator.controller;

import org.luxor.generator.entity.ProjectModel;
import org.luxor.generator.service.SysProjectModelService;
import org.luxor.generator.utils.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 自定义配置
 *
 * @author Mark sunlightcs@gmail.com
 */
@RestController
@RequestMapping("/sys/projectModel")
public class SysProjectModelController {

    @Resource
    private SysProjectModelService sysProjectModelService;

    /**
     * 保存配置项
     */
    @PostMapping("/save")
    public R save(@RequestBody ProjectModel projectModel) {
        return R.ok("保存成功").put("data", sysProjectModelService.save(projectModel));
    }

    /**
     * 获取配置项
     */
    @GetMapping("/info")
    public R getProjectModel() {
        return R.ok("获取成功").put("data", sysProjectModelService.info());
    }

    /**
     * 重置配置项
     * @return
     */
    @PostMapping("/reset")
    public R resetProjectModel() {
        return R.ok("重置成功").put("data", sysProjectModelService.reset());
    }
}
